const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')
// const { TDesignResolver } = require('unplugin-vue-components/resolvers');

module.exports = {
    publicPath:'./',
    outputDir:'dist',
    assetsDir:'static',
    productionSourceMap:false,
	  lintOnSave:false, //关闭语法检查
    // css: {
    //     loaderOptions: {
    //     sass: {
    //         prependData: `@import "@/assets/style/global_config.scss";` ,//引入全局变量   
    //         prependData: '@use "@/assets/style/element.scss" as *;'
    //     }
    //     }
    // },
    chainWebpack (config) {
      config.resolve.extensions
            .add('ts')
            .add('tsx');
      const oneOfsMap = config.module.rule('scss').oneOfs.store
      oneOfsMap.forEach((item) => {
        item
          .use('sass-resources-loader')
          .loader('sass-resources-loader')
          .options({
            hoistUseStatements: true,
            resources: './src/assets/style/global_config.scss'
          })
          .end()
      })
    },
    configureWebpack: {
          plugins: [
            AutoImport({
              resolvers: [ElementPlusResolver({
                importStyle: false
                // exclude: new RegExp(/^(?!.*loading-directive).*$/)
              })],
              // resolvers: [TDesignResolver()],
            }),
            Components({
              resolvers: [ElementPlusResolver()],
              // resolvers: [TDesignResolver()],
            }),
          ],
    },
    pages: {
        index: {
          entry: 'src/main.js',
          template: 'public/index.html',
          filename: 'index.html',
          title: 'Web OS',
          chunks: ['chunk-vendors', 'chunk-common', 'index']
        }, 
    }
}